package org.lld.im.service.conversation.controller;

import org.lld.im.common.ResponseVO;
import org.lld.im.service.conversation.model.DeleteConversationReq;
import org.lld.im.service.conversation.model.UpdateConversationReq;
import org.lld.im.service.conversation.service.ConversationService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: LunBoWang
 * @description: TODO
 * @date: 2025/4/8 下午4:35
 * @version: 1.0
 */
@RestController
@RequestMapping("v1/conversation")
public class ConversationController {
    @Resource
    ConversationService conversationService;

    @RequestMapping("/deleteConversation")
    public ResponseVO deleteConversation(@RequestBody @Validated DeleteConversationReq req,
                                         Integer appId, String identifier) {
        req.setAppId(appId);
        req.setFromId(identifier);
        return conversationService.deleteConversation(req);
    }

    @RequestMapping("/updateConversation")
    public ResponseVO updateConversation(@RequestBody @Validated UpdateConversationReq req,
                                         Integer appId, String identifier) {
        req.setAppId(appId);
        req.setFromId(identifier);
        return conversationService.updateConversation(req);
    }
}
